package cn.yunhe.control;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.yunhe.entity.Blank;
import cn.yunhe.server.BlankServer;

@WebServlet("/BlankServlet")
public class BlankServlet extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		BlankServer bServer = new BlankServer();
		List<Blank> list = bServer.getAllBlank(); //调用获取所有板块方法

		if (list!=null&&list.size()>0) {
			request.setAttribute("blankList", list);
			request.getRequestDispatcher("addTopicOnblank.jsp").forward(request, response);
		}else {
			request.setAttribute("blankList", "暂无板块");
			request.getRequestDispatcher("blankManager.jsp").forward(request, response);
		}
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(req, resp);
	}
}
